//
//  RedundRiskController.m
//  WBBaseProject
//
//  Created by xiaozhi on 2018/4/11.
//  Copyright © 2018年 吴斌. All rights reserved.
//

#import "RefundRiskController.h"
#import "RefundRiskView.h"
#import "RefundRiskSuccess.h"
#import "RefundRiskRechargeView.h"
#import "RefundRiskRechargeSuccess.h"
#import "UILabel+ChangeLineSpaceAndWordSpace.h"

@interface RefundRiskController ()

@property(nonatomic,strong) UIScrollView *bgView;
@end

@implementation RefundRiskController

- (UIScrollView *)bgView
{
    if (!_bgView) {
        _bgView  = [[UIScrollView alloc]initWithFrame:self.view.bounds];
        _bgView.contentSize = CGSizeMake(kScreenWidth, kScreenHeight+1);
        [self.view addSubview:_bgView];
    }
    return _bgView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"风险保证金";
    [self setUp];
}
- (void)setUp
{
    UIView *vi;
    switch (self.type) {
        case RefundRisksuccess:
        {//退款成功
             vi = [[NSBundle mainBundle]loadNibNamed:@"RefundRiskSuccess" owner:nil options:nil].firstObject;
            
            break;
        }
        case RefundRiskNomal:
        {//退保证金
            RefundRiskView *view = [[NSBundle mainBundle] loadNibNamed:@"RefundRiskView" owner:nil options:nil].firstObject;
            vi = view;
            
            view.notiLb.text = @"1.在没有未结清和申请的借款单的情况下，保证金随时可退；\n2.申请退还保证金，保证金将在1-2个工作日内退至账户余额；\n3.退还保证金，将不再享有幸运贷平台提供的借款服务。";
            [UILabel changeLineSpaceForLabel:view.notiLb WithSpace:5.0];
            
            view.refundClick = ^{
                
                RefundRiskController *vc = [[RefundRiskController alloc]init];
                vc.type =RefundRisksuccess;
                [self.navigationController pushViewController:vc animated:YES];
            };
            break;
        }
        case RefundRiskRecharge:
        {//充值保证金
            RefundRiskRechargeView *view = [[NSBundle mainBundle]loadNibNamed:@"RefundRiskRechargeView" owner:nil options:nil].firstObject;
            vi = view;
            view.rechargeClick = ^{
                
                RefundRiskController *vc = [[RefundRiskController alloc]init];
                vc.type =RefundRiskRechargesucces;
                [self.navigationController pushViewController:vc animated:YES];
            };
            
            break;
        }case RefundRiskRechargesucces:
        {//充值保证金成功
           RefundRiskRechargeSuccess *view =[[NSBundle mainBundle]loadNibNamed:@"RefundRiskRechargeSuccess" owner:nil options:nil].firstObject;
            vi = view;
            view.clickImg = ^(NSInteger index) {
                
            };
            view.backToRiskAccount = ^{
                
                NSArray *arr =self.navigationController.viewControllers;
                UIViewController *vc = arr[arr.count-1-2];
                [self.navigationController popToViewController:vc animated:YES];
            };
            view.backToHome = ^{
                [self.navigationController popToRootViewControllerAnimated:YES];
            };
            break;
        }
        default:
            break;
    }
    vi.frame = self.view.bounds;
    [self.bgView addSubview:vi];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
